<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Eigen: Matrix-free solvers</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="eigendoxy.css" rel="stylesheet" type="text/css">
<!--  -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>
   &#160;<span id="projectnumber">3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)</span>
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group__MatrixfreeSolverExample.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Matrix-free solvers<div class="ingroups"><a class="el" href="group__Sparse__chapter.html">Sparse linear algebra</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<p>Iterative solvers such as <a class="el" href="classEigen_1_1ConjugateGradient.html" title="A conjugate gradient solver for sparse (or dense) self-adjoint problems.">ConjugateGradient</a> and <a class="el" href="classEigen_1_1BiCGSTAB.html" title="A bi conjugate gradient stabilized solver for sparse square problems.">BiCGSTAB</a> can be used in a matrix free context. To this end, user must provide a wrapper class inheriting EigenBase&lt;&gt; and implementing the following methods:</p><ul>
<li><code>Index</code> <code>rows()</code> and <code>Index</code> <code>cols()</code>: returns number of rows and columns respectively</li>
<li><code>operator*</code> with your type and an Eigen dense column vector (its actual implementation goes in a specialization of the internal::generic_product_impl class)</li>
</ul>
<p><code>Eigen::internal::traits&lt;&gt;</code> must also be specialized for the wrapper type.</p>
<p>Here is a complete example wrapping an <a class="el" href="classEigen_1_1SparseMatrix.html" title="A versatible sparse matrix representation.">Eigen::SparseMatrix</a>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;Eigen/Core&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;Eigen/Dense&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;Eigen/IterativeLinearSolvers&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;unsupported/Eigen/IterativeSolvers&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">class </span>MatrixReplacement;</div>
<div class="line"><span class="keyword">using</span> <a class="code" href="classEigen_1_1SparseMatrix.html">Eigen::SparseMatrix</a>;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">namespace </span><a class="code" href="namespaceEigen.html">Eigen</a> {</div>
<div class="line"><span class="keyword">namespace </span>internal {</div>
<div class="line">  <span class="comment">// MatrixReplacement looks-like a SparseMatrix, so let&#39;s inherits its traits:</span></div>
<div class="line">  <span class="keyword">template</span>&lt;&gt;</div>
<div class="line">  <span class="keyword">struct </span>traits&lt;MatrixReplacement&gt; :  <span class="keyword">public</span> Eigen::internal::traits&lt;Eigen::SparseMatrix&lt;double&gt; &gt;</div>
<div class="line">  {};</div>
<div class="line">}</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Example of a matrix-free wrapper from a user type to Eigen&#39;s compatible type</span></div>
<div class="line"><span class="comment">// For the sake of simplicity, this example simply wrap a Eigen::SparseMatrix.</span></div>
<div class="line"><span class="keyword">class </span>MatrixReplacement : <span class="keyword">public</span> <a class="code" href="structEigen_1_1EigenBase.html">Eigen::EigenBase</a>&lt;MatrixReplacement&gt; {</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">  <span class="comment">// Required typedefs, constants, and method:</span></div>
<div class="line">  <span class="keyword">typedef</span> <span class="keywordtype">double</span> Scalar;</div>
<div class="line">  <span class="keyword">typedef</span> <span class="keywordtype">double</span> RealScalar;</div>
<div class="line">  <span class="keyword">typedef</span> <span class="keywordtype">int</span> StorageIndex;</div>
<div class="line">  <span class="keyword">enum</span> {</div>
<div class="line">    ColsAtCompileTime = <a class="code" href="namespaceEigen.html#ad81fa7195215a0ce30017dfac309f0b2">Eigen::Dynamic</a>,</div>
<div class="line">    MaxColsAtCompileTime = <a class="code" href="namespaceEigen.html#ad81fa7195215a0ce30017dfac309f0b2">Eigen::Dynamic</a>,</div>
<div class="line">    IsRowMajor = <span class="keyword">false</span></div>
<div class="line">  };</div>
<div class="line"> </div>
<div class="line">  <a class="code" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Index</a> rows()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mp_mat-&gt;rows(); }</div>
<div class="line">  <a class="code" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Index</a> cols()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mp_mat-&gt;cols(); }</div>
<div class="line"> </div>
<div class="line">  <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Rhs&gt;</div>
<div class="line">  <a class="code" href="classEigen_1_1Product.html">Eigen::Product&lt;MatrixReplacement,Rhs,Eigen::AliasFreeProduct&gt;</a> <a class="code" href="namespaceEigen.html#a9723b3ff0f2c99fe1081e3eb14380d4c">operator*</a>(<span class="keyword">const</span> <a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase&lt;Rhs&gt;</a>&amp; x)<span class="keyword"> const </span>{</div>
<div class="line">    <span class="keywordflow">return</span> <a class="code" href="classEigen_1_1Product.html">Eigen::Product&lt;MatrixReplacement,Rhs,Eigen::AliasFreeProduct&gt;</a>(*<span class="keyword">this</span>, x.<a class="code" href="classEigen_1_1DenseCoeffsBase_3_01Derived_00_01DirectWriteAccessors_01_4.html#a1fbabe7f12bcbfba3b9a448b1f5e46fa">derived</a>());</div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="comment">// Custom API:</span></div>
<div class="line">  MatrixReplacement() : mp_mat(0) {}</div>
<div class="line"> </div>
<div class="line">  <span class="keywordtype">void</span> attachMyMatrix(<span class="keyword">const</span> SparseMatrix&lt;double&gt; &amp;mat) {</div>
<div class="line">    mp_mat = &amp;mat;</div>
<div class="line">  }</div>
<div class="line">  <span class="keyword">const</span> SparseMatrix&lt;double&gt; my_matrix()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *mp_mat; }</div>
<div class="line"> </div>
<div class="line"><span class="keyword">private</span>:</div>
<div class="line">  <span class="keyword">const</span> SparseMatrix&lt;double&gt; *mp_mat;</div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// Implementation of MatrixReplacement * Eigen::DenseVector though a specialization of internal::generic_product_impl:</span></div>
<div class="line"><span class="keyword">namespace </span><a class="code" href="namespaceEigen.html">Eigen</a> {</div>
<div class="line"><span class="keyword">namespace </span>internal {</div>
<div class="line"> </div>
<div class="line">  <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Rhs&gt;</div>
<div class="line">  <span class="keyword">struct </span>generic_product_impl&lt;MatrixReplacement, Rhs, SparseShape, DenseShape, GemvProduct&gt; <span class="comment">// GEMV stands for matrix-vector</span></div>
<div class="line">  : generic_product_impl_base&lt;MatrixReplacement,Rhs,generic_product_impl&lt;MatrixReplacement,Rhs&gt; &gt;</div>
<div class="line">  {</div>
<div class="line">    <span class="keyword">typedef</span> <span class="keyword">typename</span> Product&lt;MatrixReplacement,Rhs&gt;::Scalar Scalar;</div>
<div class="line"> </div>
<div class="line">    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Dest&gt;</div>
<div class="line">    <span class="keyword">static</span> <span class="keywordtype">void</span> scaleAndAddTo(Dest&amp; dst, <span class="keyword">const</span> MatrixReplacement&amp; lhs, <span class="keyword">const</span> Rhs&amp; rhs, <span class="keyword">const</span> Scalar&amp; alpha)</div>
<div class="line">    {</div>
<div class="line">      <span class="comment">// This method should implement &quot;dst += alpha * lhs * rhs&quot; inplace,</span></div>
<div class="line">      <span class="comment">// however, for iterative solvers, alpha is always equal to 1, so let&#39;s not bother about it.</span></div>
<div class="line">      assert(alpha==Scalar(1) &amp;&amp; <span class="stringliteral">&quot;scaling is not implemented&quot;</span>);</div>
<div class="line">      EIGEN_ONLY_USED_FOR_DEBUG(alpha);</div>
<div class="line"> </div>
<div class="line">      <span class="comment">// Here we could simply call dst.noalias() += lhs.my_matrix() * rhs,</span></div>
<div class="line">      <span class="comment">// but let&#39;s do something fancier (and less efficient):</span></div>
<div class="line">      <span class="keywordflow">for</span>(<a class="code" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Index</a> i=0; i&lt;lhs.cols(); ++i)</div>
<div class="line">        dst += rhs(i) * lhs.my_matrix().col(i);</div>
<div class="line">    }</div>
<div class="line">  };</div>
<div class="line"> </div>
<div class="line">}</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main()</div>
<div class="line">{</div>
<div class="line">  <span class="keywordtype">int</span> n = 10;</div>
<div class="line">  <a class="code" href="classEigen_1_1SparseMatrix.html">Eigen::SparseMatrix&lt;double&gt;</a> S = <a class="code" href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">Eigen::MatrixXd::Random</a>(n,n).sparseView(0.5,1);</div>
<div class="line">  S = S.transpose()*S;</div>
<div class="line"> </div>
<div class="line">  MatrixReplacement A;</div>
<div class="line">  A.attachMyMatrix(S);</div>
<div class="line"> </div>
<div class="line">  <a class="code" href="classEigen_1_1Matrix.html">Eigen::VectorXd</a> b(n), x;</div>
<div class="line">  b.<a class="code" href="classEigen_1_1PlainObjectBase.html#a5f0f6cc8039ed5ac026cd32ed5bbe6ea">setRandom</a>();</div>
<div class="line"> </div>
<div class="line">  <span class="comment">// Solve Ax = b using various iterative solver with matrix-free version:</span></div>
<div class="line">  {</div>
<div class="line">    <a class="code" href="classEigen_1_1ConjugateGradient.html">Eigen::ConjugateGradient&lt;MatrixReplacement, Eigen::Lower|Eigen::Upper, Eigen::IdentityPreconditioner&gt;</a> cg;</div>
<div class="line">    cg.<a class="code" href="classEigen_1_1IterativeSolverBase.html#a7dfa55c55e82d697bde227696a630914">compute</a>(A);</div>
<div class="line">    x = cg.<a class="code" href="classEigen_1_1SparseSolverBase.html#a4a66e9498b06e3ec4ec36f06b26d4e8f">solve</a>(b);</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;CG:       #iterations: &quot;</span> &lt;&lt; cg.<a class="code" href="classEigen_1_1IterativeSolverBase.html#ae778dd098bd5e6655625b20b1e9f15da">iterations</a>() &lt;&lt; <span class="stringliteral">&quot;, estimated error: &quot;</span> &lt;&lt; cg.<a class="code" href="classEigen_1_1IterativeSolverBase.html#a117c241af3fb1141ad0916a3cf3157ec">error</a>() &lt;&lt; std::endl;</div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  {</div>
<div class="line">    <a class="code" href="classEigen_1_1BiCGSTAB.html">Eigen::BiCGSTAB&lt;MatrixReplacement, Eigen::IdentityPreconditioner&gt;</a> bicg;</div>
<div class="line">    bicg.<a class="code" href="classEigen_1_1IterativeSolverBase.html#a7dfa55c55e82d697bde227696a630914">compute</a>(A);</div>
<div class="line">    x = bicg.<a class="code" href="classEigen_1_1SparseSolverBase.html#a4a66e9498b06e3ec4ec36f06b26d4e8f">solve</a>(b);</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;BiCGSTAB: #iterations: &quot;</span> &lt;&lt; bicg.<a class="code" href="classEigen_1_1IterativeSolverBase.html#ae778dd098bd5e6655625b20b1e9f15da">iterations</a>() &lt;&lt; <span class="stringliteral">&quot;, estimated error: &quot;</span> &lt;&lt; bicg.<a class="code" href="classEigen_1_1IterativeSolverBase.html#a117c241af3fb1141ad0916a3cf3157ec">error</a>() &lt;&lt; std::endl;</div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  {</div>
<div class="line">    Eigen::GMRES&lt;MatrixReplacement, Eigen::IdentityPreconditioner&gt; gmres;</div>
<div class="line">    gmres.compute(A);</div>
<div class="line">    x = gmres.solve(b);</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;GMRES:    #iterations: &quot;</span> &lt;&lt; gmres.iterations() &lt;&lt; <span class="stringliteral">&quot;, estimated error: &quot;</span> &lt;&lt; gmres.error() &lt;&lt; std::endl;</div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  {</div>
<div class="line">    Eigen::DGMRES&lt;MatrixReplacement, Eigen::IdentityPreconditioner&gt; gmres;</div>
<div class="line">    gmres.compute(A);</div>
<div class="line">    x = gmres.solve(b);</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;DGMRES:   #iterations: &quot;</span> &lt;&lt; gmres.iterations() &lt;&lt; <span class="stringliteral">&quot;, estimated error: &quot;</span> &lt;&lt; gmres.error() &lt;&lt; std::endl;</div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  {</div>
<div class="line">    Eigen::MINRES&lt;MatrixReplacement, Eigen::Lower|Eigen::Upper, Eigen::IdentityPreconditioner&gt; minres;</div>
<div class="line">    minres.compute(A);</div>
<div class="line">    x = minres.solve(b);</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;MINRES:   #iterations: &quot;</span> &lt;&lt; minres.iterations() &lt;&lt; <span class="stringliteral">&quot;, estimated error: &quot;</span> &lt;&lt; minres.error() &lt;&lt; std::endl;</div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="ttc" id="aclassEigen_1_1BiCGSTAB_html"><div class="ttname"><a href="classEigen_1_1BiCGSTAB.html">Eigen::BiCGSTAB</a></div><div class="ttdoc">A bi conjugate gradient stabilized solver for sparse square problems.</div><div class="ttdef"><b>Definition:</b> BiCGSTAB.h:161</div></div>
<div class="ttc" id="aclassEigen_1_1ConjugateGradient_html"><div class="ttname"><a href="classEigen_1_1ConjugateGradient.html">Eigen::ConjugateGradient</a></div><div class="ttdoc">A conjugate gradient solver for sparse (or dense) self-adjoint problems.</div><div class="ttdef"><b>Definition:</b> ConjugateGradient.h:161</div></div>
<div class="ttc" id="aclassEigen_1_1DenseBase_html_ae814abb451b48ed872819192dc188c19"><div class="ttname"><a href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">Eigen::DenseBase::Random</a></div><div class="ttdeci">static const RandomReturnType Random()</div><div class="ttdef"><b>Definition:</b> Random.h:114</div></div>
<div class="ttc" id="aclassEigen_1_1DenseCoeffsBase_3_01Derived_00_01DirectWriteAccessors_01_4_html_a1fbabe7f12bcbfba3b9a448b1f5e46fa"><div class="ttname"><a href="classEigen_1_1DenseCoeffsBase_3_01Derived_00_01DirectWriteAccessors_01_4.html#a1fbabe7f12bcbfba3b9a448b1f5e46fa">Eigen::DenseCoeffsBase&lt; Derived, DirectWriteAccessors &gt;::derived</a></div><div class="ttdeci">Derived &amp; derived()</div><div class="ttdef"><b>Definition:</b> EigenBase.h:48</div></div>
<div class="ttc" id="aclassEigen_1_1IterativeSolverBase_html_a117c241af3fb1141ad0916a3cf3157ec"><div class="ttname"><a href="classEigen_1_1IterativeSolverBase.html#a117c241af3fb1141ad0916a3cf3157ec">Eigen::IterativeSolverBase::error</a></div><div class="ttdeci">RealScalar error() const</div><div class="ttdef"><b>Definition:</b> IterativeSolverBase.h:310</div></div>
<div class="ttc" id="aclassEigen_1_1IterativeSolverBase_html_a7dfa55c55e82d697bde227696a630914"><div class="ttname"><a href="classEigen_1_1IterativeSolverBase.html#a7dfa55c55e82d697bde227696a630914">Eigen::IterativeSolverBase::compute</a></div><div class="ttdeci">Derived &amp; compute(const EigenBase&lt; MatrixDerived &gt; &amp;A)</div><div class="ttdef"><b>Definition:</b> IterativeSolverBase.h:243</div></div>
<div class="ttc" id="aclassEigen_1_1IterativeSolverBase_html_ae778dd098bd5e6655625b20b1e9f15da"><div class="ttname"><a href="classEigen_1_1IterativeSolverBase.html#ae778dd098bd5e6655625b20b1e9f15da">Eigen::IterativeSolverBase::iterations</a></div><div class="ttdeci">Index iterations() const</div><div class="ttdef"><b>Definition:</b> IterativeSolverBase.h:301</div></div>
<div class="ttc" id="aclassEigen_1_1MatrixBase_html"><div class="ttname"><a href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase</a></div><div class="ttdoc">Base class for all dense matrices, vectors, and expressions.</div><div class="ttdef"><b>Definition:</b> MatrixBase.h:52</div></div>
<div class="ttc" id="aclassEigen_1_1Matrix_html"><div class="ttname"><a href="classEigen_1_1Matrix.html">Eigen::Matrix</a></div><div class="ttdoc">The matrix class, also used for vectors and row-vectors.</div><div class="ttdef"><b>Definition:</b> Matrix.h:182</div></div>
<div class="ttc" id="aclassEigen_1_1PlainObjectBase_html_a5f0f6cc8039ed5ac026cd32ed5bbe6ea"><div class="ttname"><a href="classEigen_1_1PlainObjectBase.html#a5f0f6cc8039ed5ac026cd32ed5bbe6ea">Eigen::PlainObjectBase::setRandom</a></div><div class="ttdeci">Derived &amp; setRandom(Index size)</div><div class="ttdef"><b>Definition:</b> Random.h:152</div></div>
<div class="ttc" id="aclassEigen_1_1Product_html"><div class="ttname"><a href="classEigen_1_1Product.html">Eigen::Product</a></div><div class="ttdoc">Expression of the product of two arbitrary matrices or vectors.</div><div class="ttdef"><b>Definition:</b> Product.h:77</div></div>
<div class="ttc" id="aclassEigen_1_1SparseMatrix_html"><div class="ttname"><a href="classEigen_1_1SparseMatrix.html">Eigen::SparseMatrix</a></div><div class="ttdoc">A versatible sparse matrix representation.</div><div class="ttdef"><b>Definition:</b> SparseMatrix.h:100</div></div>
<div class="ttc" id="aclassEigen_1_1SparseSolverBase_html_a4a66e9498b06e3ec4ec36f06b26d4e8f"><div class="ttname"><a href="classEigen_1_1SparseSolverBase.html#a4a66e9498b06e3ec4ec36f06b26d4e8f">Eigen::SparseSolverBase::solve</a></div><div class="ttdeci">const Solve&lt; Derived, Rhs &gt; solve(const MatrixBase&lt; Rhs &gt; &amp;b) const</div><div class="ttdef"><b>Definition:</b> SparseSolverBase.h:92</div></div>
<div class="ttc" id="anamespaceEigen_html"><div class="ttname"><a href="namespaceEigen.html">Eigen</a></div><div class="ttdoc">Namespace containing all symbols from the Eigen library.</div><div class="ttdef"><b>Definition:</b> Core:139</div></div>
<div class="ttc" id="anamespaceEigen_html_a62e77e0933482dafde8fe197d9a2cfde"><div class="ttname"><a href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Eigen::Index</a></div><div class="ttdeci">EIGEN_DEFAULT_DENSE_INDEX_TYPE Index</div><div class="ttdoc">The Index type as used for the API.</div><div class="ttdef"><b>Definition:</b> Meta.h:59</div></div>
<div class="ttc" id="anamespaceEigen_html_a9723b3ff0f2c99fe1081e3eb14380d4c"><div class="ttname"><a href="namespaceEigen.html#a9723b3ff0f2c99fe1081e3eb14380d4c">Eigen::operator*</a></div><div class="ttdeci">const Product&lt; MatrixDerived, PermutationDerived, AliasFreeProduct &gt; operator*(const MatrixBase&lt; MatrixDerived &gt; &amp;matrix, const PermutationBase&lt; PermutationDerived &gt; &amp;permutation)</div><div class="ttdef"><b>Definition:</b> PermutationMatrix.h:517</div></div>
<div class="ttc" id="anamespaceEigen_html_ad81fa7195215a0ce30017dfac309f0b2"><div class="ttname"><a href="namespaceEigen.html#ad81fa7195215a0ce30017dfac309f0b2">Eigen::Dynamic</a></div><div class="ttdeci">const int Dynamic</div><div class="ttdef"><b>Definition:</b> Constants.h:24</div></div>
<div class="ttc" id="astructEigen_1_1EigenBase_html"><div class="ttname"><a href="structEigen_1_1EigenBase.html">Eigen::EigenBase</a></div><div class="ttdef"><b>Definition:</b> EigenBase.h:32</div></div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">CG:       #iterations: 20, estimated error: 8.86333e-14
BiCGSTAB: #iterations: 20, estimated error: 2.10809e-15
GMRES:    #iterations: 10, estimated error: 0
DGMRES:   #iterations: 20, estimated error: 1.10455e-28
MINRES:   #iterations: 20, estimated error: 2.94473e-14
</pre> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Thu Apr 21 2022 13:07:55 for Eigen by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
